import request from '@/utils/request'

export function fetchList(query) {
  return request({
    url: '/article/list',
    method: 'get',
    params: query
  })
}

export function fetchArticle(id) {
  return request({
    url: '/article/detail',
    method: 'get',
    params: { id }
  })
}

export function fetchPv(pv) {
  return request({
    url: '/article/pv',
    method: 'get',
    params: { pv }
  })
}
// 新增（保存）
export function createArticle(data) {
  return request({
    url: '/form/createArticle',
    method: 'post',
    data
  })
}

export function updateArticle(data) {
  return request({
    url: '/article/update',
    method: 'post',
    data
  })
}

export function add(data) {
  return request({
    url: '/form/add',
    method: 'get',
    param: { data }
  })
}

export function fetchOptions(data) {
  return request({
    url: '/form/fetchOptions',
    method: 'get',
    param: { data }
  })
}

export function queryMenu(data) {
  return request({
    url: '/form/queryMenu',
    method: 'get',
    data
  })
}

export function fetchTree(data) {
  return request({
    url: '/form/fetchTree',
    method: 'get',
    param: { data }
  })
}

